//go:build windows
// +build windows

package common

import (
	"log"
	"net"
	"syscall"
)

func GetListenConfig() *net.ListenConfig {
	l := &net.ListenConfig{Control: func(network, address string, c syscall.RawConn) error {
		var opErr error
		c.Control(func(fd uintptr) {
			opErr = syscall.SetsockoptInt(syscall.Handle(fd), syscall.SOL_SOCKET, syscall.SO_REUSEADDR, 1)
			if opErr != nil {
				log.Print(opErr)
			}
		})
		return opErr
	}}
	return l
}
